package com.njuse.jvmfinal.Instruction;

import java.nio.ByteBuffer;

import com.njuse.jvmfinal.memory.jclass.runtimeConstantPool.RuntimeConstantPool;
import com.njuse.jvmfinal.memory.jclass.runtimeConstantPool.constant.Constant;
import com.njuse.jvmfinal.memory.jclass.runtimeConstantPool.constant.wrapper.FloatWrapper;
import com.njuse.jvmfinal.memory.jclass.runtimeConstantPool.constant.wrapper.IntWrapper;
import com.njuse.jvmfinal.runtimestructure.Jframe;

public class IINC extends Instruction {
	private int index;
	private int con;
	
	public  void readindex(ByteBuffer reader) {
		this.index= (int) reader.get();
		this.con=(int) reader.get();
	}
	
	public void execute(Jframe frame) {
		Object[] local=frame.getLocal();
		int temp=(int) local[index];
		temp=temp+con;
		local[index]=temp;
		frame.setLocal(local);
	}
}
